<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>

    <script>
        window.onload = function() {
            // 获取div标签
            var oDiv = document.getElementById("mydiv");
            // 读取div标签包裹的内容
            var content = oDiv.innerHTML;
            // alert(content);
            // 设置标签包裹的内容
            oDiv.innerHTML = "<a href='http://www.baidu.com'>百度</a>";
        };
    </script>
</head>
<body>
    <div id="mydiv">我是一个div标签</div>
</body>
</html>